//统一管理项目接口的模块
//引入二次封装的axios（带有请求、响应的拦截器）
import requests from "./request";

// 判断用户是否登入 /api/login   POST
export const checkUser = (loginForm) =>
  requests({ url: "/login", method: "post", data: loginForm });

//#region 物品发布页
//连表获取物品信息
export const getGoodsList = (queryInfo) =>
  requests({ url: `/getGoods?queryInfo=${queryInfo}`, method: "get" });

//物品发布页搜索数据
export const searchGoodList = (keyWord) =>
  requests({ url: `/searchGoodsList?keyWord=${keyWord}`, method: "get" });
// 添加物品
export const addGoodList = (goodsForm) =>
  requests({ url: `/addGoods?goodsForm=${goodsForm}`, method: "get" });
// 删除物品
export const delGoodList = (id) =>
  requests({ url: `/delGoods?id=${id}`, method: "get" });
// 根据id获取物品数据
export const getIdGoods = (id) =>
  requests({ url: `/getIdGoods?id=${id}`, method: "get" });
// 更新物品
export const updateGoodList = (goodsForm) =>
  requests({ url: `/updateGoods?goodsForm=${goodsForm}`, method: "get" });

// 统计一共有多少条物品信息 totalNumGoodsList
export const totalNumGoods = () =>
  requests({ url: `/totalNumGoodsList`, method: "get" });

//#endregion

//#region 用户管理页
// 获取用户列表
export const getUserList = (queryInfo) =>
  requests({ url: `/getUser?queryInfo=${queryInfo}`, method: "get" });
//物品发布页搜索数据
export const searchUserList = (keyWord) =>
  requests({ url: `/searchUser?keyWord=${keyWord}`, method: "get" });
// 统计一共有多少用户
export const totalNumUser = () =>
  requests({ url: `/totalNumUserList`, method: "get" });
// 删除用户
export const delUser = (id) =>
  requests({ url: `/delUser?id=${id}`, method: "get" });
// 修改用户密码
export const resetUserPwd = (passForm) =>
  requests({ url: `/resetUserPwd?passForm=${passForm}`, method: "get" });
// 修改用户信息
export const updateUser = (userInfoForm) =>
  requests({ url: `/updateUser?userInfoForm=${userInfoForm}`, method: "get" });
// 注册用户信息
export const regUser = (RegForm) =>
  requests({ url: `/regUser?RegForm=${RegForm}`, method: "get" });
//#endregion

//#region 物品展示页
// 搜索和页面刷新获取数据
export const goodsShow = (keyWord) =>
  requests({ url: `/goodsShow?keyWord=${keyWord}`, method: "get" });
// 领取物品
export const lingquGoods = (lingquInfo) =>
  requests({ url: `/lingquGoods?lingquInfo=${lingquInfo}`, method: "get" });
//#endregion
